import sys
import os
from PyQt5.QtWidgets import QApplication
from src.gui.main_window import MainWindow
from src.utils.logger import logger

def main():
    try:
        logger.info("启动应用程序")
        logger.debug(f"当前工作目录: {os.getcwd()}")
        logger.debug(f"Python路径: {sys.path}")
        
        app = QApplication(sys.argv)
        window = MainWindow()
        window.show()
        
        logger.info("应用程序界面已加载")
        return app.exec_()
        
    except Exception as e:
        logger.error(f"应用程序运行失败: {str(e)}")
        return 1

if __name__ == "__main__":
    sys.exit(main())
